﻿using Dsl.Ped.AddIn.Java.Generated;
using Dsl.Ped.AddIn.Java.Resources;

namespace Dsl.Ped.AddIn.Java.Helpers
{
    /// <summary>
    /// Helper methods of the <see cref="Field"/>
    /// </summary>
    public static class FieldHelper
    {
        /// <summary>
        /// Converts the <see cref="Field"/> object to its plain text representation
        /// </summary>
        /// <param name="field"><see cref="Field"/> object to be converted into a plain text</param>
        /// <param name="tabsCount">Tab count representing an indent</param>
        /// <returns>Strin representing a <see cref="field"/> converted to a plain text</returns>
        public static string ToPlainText(this Field field, int tabsCount)
        {
            string tabs = new string('\t', tabsCount);
            return string.Format("{0}{1}{2}{1} {3};\r\n", tabs, JavaResources.KeyWordsDelimiter, field.type, field.name);
        }
    }
}
